package action;

import java.sql.SQLException;
import java.util.List;

import model.TBook;
import model.TBulletin;
import impl.TBookDAOimpl;
import impl.TBulletinDAOimpl;
import DAO.TBookDAO;
import DAO.TBulletinDAO;

import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionSupport;
/**
 * 查图书推荐2-查借阅排行1 --查最新公告4---查上架图书3
 * @author Administrator
 *
 */
public class indexAction extends ActionSupport {

	
	
	/**
	 * @return
	 */
	public String execute() {
		
	
		TBookDAOimpl tbd=new TBookDAOimpl();
		TBulletinDAO tbu=new TBulletinDAOimpl();
		try {
			List<TBook> list1= tbd.selecTBooks();	//借阅排行1
			List<TBook> list2=tbd.selectallbynull();//最新上架图书前六2
			//List<TBook> list3=tbd.selectallbynull();//最新上架
			List<TBulletin> list4=tbu.listTBull("1");//最新公告
			String json=JSON.toJSONString(list4);
			//System.out.println(list+"     "+json);查询成功
			System.out.println(json);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
		
		return SUCCESS;
	}
}